package com.woniu.his.cms.client;

import com.woniu.his.cms.client.config.OssUtil;
import com.woniu.his.cms.client.param.DmsNonDrugParam;
import com.woniu.his.cms.client.param.DmsNonDrugQueryParam;
import com.woniu.his.cms.client.param.UploadCheckResultParam;
import com.woniu.his.cms.client.result.*;
import com.woniu.his.cms.client.param.DmsNonDrugUpdateParam;
import com.woniu.his.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * name是项目名，contextId是client的名字
 */
@FeignClient(contextId = "NonDrugClient", name = "cms", path = "cms")
public interface NonDrugClient {


    //新增一个非药品
    @PostMapping("/createNonDrug")
    public Result<CreateNonDrugResult> createNonDrug(@RequestBody @Valid DmsNonDrugParam dmsNonDrugParam);

    //根据ids删除非药品
    @PostMapping("/delete")
    public Result deleteNonDrug(@RequestBody List<Long> ids);

    //更新
    @PostMapping("/update")
    public Result<CreateNonDrugResult> updateNonDrug(@RequestBody @Valid DmsNonDrugUpdateParam dmsNonDrugUpdateParam);


   //模糊查询非药品、且分页 只查有效的
    @PostMapping("/queryList")
    public Result<NonDrugQueryResult> queryList(@RequestBody DmsNonDrugQueryParam queryParam);


    //查询所有非药品
    @GetMapping("/listAllNonDrug")
    public Result<List<DmsNonDrugResult>> listAllNonDrug();


    /**
     * 描述：根据科室id刷新患者待检查列表
     */
    @GetMapping("/listByDept")
    Result<List<DmsMechanicItemRecordResult>> listByDept(@RequestParam("deptId") Long deptId);


    /**
     * 描述：医技登记
     */
    @GetMapping("/logNonDrugItem")
    Result logNonDrugItem(@RequestParam("itemRecordId") Long itemRecordId, @RequestParam("logStaffId") Long logStaffId);


    /**
     * 描述：上传结果
     */
    @PostMapping("/uploadResult")
    Result uploadResult(@RequestBody UploadCheckResultParam uploadCheckResultParam);


    /**
     * 描述：查询检查结果通过病例id
     */
    @GetMapping("/queryResultByCaseId")
    Result<List<NonDrugItemRecordQuerResult>> queryResultByCaseId(@RequestParam("caseHistoryId") Long caseHistoryId);


    @GetMapping("/quertById")
    public Result<DmsNonDrugResult> queryById(@RequestParam("id") Long id);


    /**
     * 上传结果图片
     * @param file
     * @return
     * @throws Exception
     */
    @PostMapping("/upload")
    public Result<String> upload(@RequestBody @Valid @NotNull MultipartFile file) throws Exception;

}
